package com.com.test17;

public class Test {
    public static void main(String[] args) {
        //创建15个用户对象数组
        User[] users = new User[15];

        //将id赋值给users
        for (int i = 0; i < users.length; i++){
            //给id因为题目要求1-15
            users[i] = new User(i+1,null);
        }

        //创建接待员r1负责v1过滤
        Receptionist r1 = new Receptionist(new Filter() {
            @Override
            //重写方法，添加用户类型
            public void filterUser(User user) {
                user.setType("V1");
            }
        });

        //将1-5个用户交给r1
        for (int i = 0;i<5;i++){
            r1.handleUser(users[i]);
        }

        //创建接待员r2负责v2过滤
        Receptionist r2 = new Receptionist(new Filter() {
            @Override
            //重写方法，添加用户类型
            public void filterUser(User user) {
                user.setType("V2");
            }
        });

        //将6-10个用户交给r2
        for (int i = 5;i<10;i++){
            r2.handleUser(users[i]);
        }

        //创建接待员r3负责a过滤
        Receptionist r3 = new Receptionist(new Filter() {
            @Override
            //重写方法，添加用户类型
            public void filterUser(User user) {
                user.setType("A");
            }
        });

        //将11-15个用户交给r3
        for (int i = 10;i<15;i++){
            r3.handleUser(users[i]);
        }

        for (User user : users){
            System.out.println(user.getId()+"-"+user.getType());
        }
    }
}
